package com.company;

public class StringDemo
{
    public static void main(String[] args)
    {
        String sentence = "Text processing is hard!";               //文本处理很困难
        int position = sentence.indexOf("hard");                  //  int indexOf(String str);返回批定字符串第一个找到的索引位置
        System.out.println(sentence);
        System.out.println("012345678901234567890123");
        System.out.println("The word \"hard\" starts at index "
                + position);
        sentence = sentence.substring(0, position) + "easy!";           //string substring(int beginIndex,int endIndex);取出指定索引范围子字符串
        sentence = sentence.toUpperCase();                              // toUpperCase();将字符串中的英文字符全部转为大写
        System.out.println("The changed string is:");                   //更改后的字符串为
        System.out.println(sentence);
    }
}